# modela_parser.py (c) 2010 by William Grover <wgrover@gmail.com>
# http://wgrover.com

import re

def mu2mm(mu):
    """Converts Modela units to millimeters"""
    # Modela units are 1/1024th of an inch (seriously).
    return mu * 25.4 / 1024.0

tokens = re.compile("([^';]+);+")
PU = re.compile("PU([-\.\d]*),*([-\.\d]*)")
PD = re.compile("PD([-\.\d]*),*([-\.\d]*)")
MC = re.compile("!MC([-\.\d]+)")
PR = re.compile("PR")
PA = re.compile("PA")
ZM = re.compile("!ZM([-\.\d]+)")
PZ = re.compile("!PZ([-\.\d]+),([-\.\d]+)")
VS = re.compile("VS")
VZ = re.compile("!VZ")